package zxs.sino.elite.hub.service.sys.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import zxs.sino.elite.hub.mapper.sys.SysLogMapper;
import zxs.sino.elite.hub.model.sys.SysLogEntity;
import zxs.sino.elite.hub.service.sys.SysLogService;
import zxs.sino.elite.hub.utils.PageUtil;
import zxs.sino.elite.hub.utils.Query;

import java.util.Map;


@Service("sysLogService")
public class SysLogServiceImpl extends MPJBaseServiceImpl<SysLogMapper, SysLogEntity> implements SysLogService {

    @Override
    public PageUtil queryPage(Map<String, Object> params) {
        String key = (String)params.get("key");

        IPage<SysLogEntity> page = this.page(
            new Query<SysLogEntity>().getPage(params),
            new QueryWrapper<SysLogEntity>().like(StringUtils.isNotBlank(key),"username", key)
        );

        return new PageUtil(page);
    }
}
